<?php
namespace app\common\service;
use app\admin\traits\Result;
use think\Db;
use think\facade\Request;
use think\facade\Env;

/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2022/7/13
 * Time: 17:29
 */
class AnswerService
{

    public static function getGuestions($s_id,$filed=''){

        $shijuanInfo = db::name('shijuan')->where(['s_id'=>$s_id])->value('info');
        if(empty($shijuanInfo)){
            return return_json(2001,'没有题目', '');
        }
        $shijuanInfo = json_decode($shijuanInfo,true);
        $ids = [];
        $shijuanInfo_sort = [];
        foreach($shijuanInfo as $k=>$v){
            $ids[] = $v['id'];
            $shijuanInfo_sort[$v['id']] = $v;
        }
        if(empty($ids)){
            return return_json(2001,'没有题目', '');
        }
        if(!empty($filed)){
            $list = db::name('questions')->field($filed)->where(['status'=>1])->where('id','in',$ids)->select();
        }else{
            $list = db::name('questions')->where(['status'=>1])->where('id','in',$ids)->select();
        }

        if(empty($list)){
            return return_json(2001,'没有题目', '');
        }
        foreach($list as $k=>$v){
            $list[$k]['sort'] = $shijuanInfo_sort[$v['id']]['sort'];
        }
        return array_values(array_sort($list,'sort','asc'));
    }
    public static function calculation($user_id,$s_id,$data){

        try{

            $answer_arr = json_decode($data,true);
            foreach ($answer_arr as $k=>$v){
                $temp = explode('_',$k);
                unset($answer_arr[$k]);
                $answer_arr[$temp[0]] = $v;
            }

            $cate = db('cate')->where('id',$answer_arr[17])->find();
            $score2 = db('cate')->where('id',$cate['parent_id'])->value('score2');
            $score2_arr = explode(',',$score2);

            $result_data = [];
            //---创新管理---
            $info1 = [];//一、创新管理维度
            //1.1创新管理人承诺、职级和战略
            $score_cx["1.1"] = 0;
            $score[87] = getPickerScore($answer_arr[87],87);
            $score_cx["1.1"] += $score[87];
            $score[88] = ($answer_arr[88] == 1)?1:0;
            $score_cx["1.1"] += $score[88];
            $score[89] = getPickerScore($answer_arr[89],89);
            $score_cx["1.1"] += $score[89];
            $score[90] = getPickerScore($answer_arr[90],90);
            $score_cx["1.1"] += $score[90];
            $score_cx["1.1"] = $score_cx["1.1"]*1.5;//1.1总分
            $score_cx_cj['1.1'] = ($score_cx["1.1"]/4.2)-1;//差距
            array_push($info1,['1.1 创新管理人承诺、职级和战略',getComparison($score_cx_cj['1.1']),round( $score_cx_cj['1.1']*100,1).'%',getComparisonIos('1.1',$score_cx_cj['1.1']),'ISO56002/5.1']);
            //1.2创新能力及显现结果
            $score_cx["1.2"] = 0;
            $score[92] = getPickerScore($answer_arr[92],92);
            $score_cx["1.2"] += $score[92];
            $score[93] = getPickerScore($answer_arr[93],93);
            $score_cx["1.2"] += $score[93];
            $score[94] = getPickerScore($answer_arr[94],94);
            $score_cx["1.2"] += $score[94];
            $score[95] = getPickerScore($answer_arr[95],95);
            $score_cx["1.2"] += $score[95];
            $score[130] = getPickerScore($answer_arr[130],130);
            $score_cx["1.2"] += $score[130];
            if ($answer_arr[131] >= 0.1) {
                $score[131] = 1;
            } else if ($answer_arr[131] < 0.1 && $answer_arr[131] >= 0.05) {
                $score[131] = 0.7;
            } else if ($answer_arr[131] < 0.05 && $answer_arr[131] >= 0.1) {
                $score[131] = 0.3;
            } else if ($answer_arr[131] < 0.01) {
                $score[131] = 0.1;
            }
            $score_cx["1.2"] += $score[131];
            $score[132] = getPickerScore($answer_arr[132],132);
            $score_cx["1.2"] += $score[132];
            $score_cx["1.2"] = $score_cx["1.2"]*1;//1.2总分
            $score_cx_cj['1.2'] = ($score_cx["1.2"]/4.9)-1;//差距
            array_push($info1,['1.2 创新能力及显现结果',getComparison($score_cx_cj['1.2']),round( $score_cx_cj['1.2']*100,1).'%',getComparisonIos('1.2',$score_cx_cj['1.2']),'ISO56002/4.1.3']);
            //1.3创新管理相关活动
            $score_cx["1.3"] = 0;
            $score[91] = getPickerScore($answer_arr[91],91);
            $score_cx["1.3"] += $score[91];
            $score_cx["1.3"] += $score[92];
            $score_cx["1.3"] += $score[93];
            $score_cx["1.3"] += $score[94];
            $score_cx["1.3"] += $score[95];
            $score[96] = ($answer_arr[96] == 1)?1:0;
            $score_cx["1.3"] += $score[96];
            $score[98] = ($answer_arr[98] == 1)?1:0;
            $score_cx["1.3"] += $score[98];
            $score[101] = getPickerScore($answer_arr[101],101);
            $score_cx["1.3"] += $score[101];
            $score[102] = ($answer_arr[102] == 1)?1:0;
            $score_cx["1.3"] += $score[102];
            $score_cx["1.3"] = $score_cx["1.3"]*0.5;//1.3总分
            $score_cx_cj['1.3'] = ($score_cx["1.3"]/3.15)-1;//差距
            array_push($info1,['1.3 创新管理相关活动',getComparison($score_cx_cj['1.3']),round( $score_cx_cj['1.3']*100,1).'%',getComparisonIos('1.3',$score_cx_cj['1.3']),'ISO56002/4.4']);
            //1.4创新决策管理机制
            $score_cx["1.4"] = 0;
            $score_cx["1.4"] += $score[96];
            $score_cx["1.4"] += $score[98];
            $score[137] = ($answer_arr[137] == 1)?1:0;
            $score_cx["1.4"] += $score[137];
            $score_cx["1.4"] = $score_cx["1.4"]*1;//1.4总分
            $score_cx_cj["1.4"] = ($score_cx["1.4"]/2.1)-1;//1.4差距
            array_push($info1,['1.4 创新决策管理机制',getComparison($score_cx_cj['1.4']),round( $score_cx_cj['1.4']*100,1).'%',getComparisonIos('1.4',$score_cx_cj['1.4']),'ISO56002/4.4.2、4.4.3']);
            $result_data[1] = ['title' => '一、创新管理维度', 'info' => $info1];

            $info2 = [];//二、知识产权管理维度
            //2.1知识产权管理人承诺、职级和战略
            $score_cx["2.1"] = 0;
            $score[142] = getPickerScore($answer_arr[142],142);
            $score_cx["2.1"] += $score[142];
            $score[143] = getPickerScore($answer_arr[143],143);
            $score_cx["2.1"] += $score[143];
            $score[146] = getPickerScore($answer_arr[146],146);
            $score_cx["2.1"] += $score[146];
            $score[148] = ($answer_arr[148] == 1)?1:0;
            $score_cx["2.1"] += $score[148];
            $score_cx["2.1"] = $score_cx["2.1"]*1.5;//2.1总分
            $score_cx_cj["2.1"] = ($score_cx["2.1"]/4.2)-1;//2.1差距
            array_push($info2,['2.1 知识产权管理人承诺、职级和战略',getComparison($score_cx_cj['2.1']),round( $score_cx_cj['2.1']*100,1).'%',getComparisonIos('2.1',$score_cx_cj['2.1']),'ISO56002/7.8   ISO56005/4.3.1']);
            //2.2知识产权能力及一级产出
            $score_cx["2.2"] = 0;
            if ($answer_arr[144] >= 10) {
                $score[144] = 1;
            } else if ($answer_arr[144] < 10 && $answer_arr[144] >= 5) {
                $score[144] = 0.8;
            } else if ($answer_arr[144] < 5 && $answer_arr[144] >= 3) {
                $score[144] = 0.6;
            } else if ($answer_arr[144] < 3 && $answer_arr[144] >= 1) {
                $score[144] = 0.4;
            } else if ($answer_arr[144] < 1) {
                $score[144] = 0;
            }
            $score_cx["2.2"] += $score[144];
            $score[152] = ($answer_arr[152] == 1)?1:0;
            $score_cx["2.2"] += $score[152];
            $rd_wanteo_one = $answer_arr[141] + $answer_arr[140] + $answer_arr[139];
            if ($rd_wanteo_one >= 600) {
                $score["141_140_139"] = 1;
            } else if ($rd_wanteo_one < 600 && $rd_wanteo_one >= 500) {
                $score["141_140_139"] = 0.8;
            } else if ($rd_wanteo_one < 500 && $rd_wanteo_one >= 400) {
                $score["141_140_139"] = 0.7;
            } else if ($rd_wanteo_one < 400 && $rd_wanteo_one >= 300) {
                $score["141_140_139"] = 0.6;
            } else if ($rd_wanteo_one < 300 && $rd_wanteo_one >= 200) {
                $score["141_140_139"] = 0.5;
            } else if ($rd_wanteo_one < 200 && $rd_wanteo_one >= 100) {
                $score["141_140_139"] = 0.4;
            } else if ($rd_wanteo_one < 100 && $rd_wanteo_one >= 1) {
                $score["141_140_139"] = 0.2;
            } else if ($rd_wanteo_one < 1) {
                $score["141_140_139"] = 0;
            }
            $score[154] = getPickerScore($answer_arr[154],154);
            $score_cx["2.2"] += $score[154];
            $score[155] = ($answer_arr[155] == 1)?1:0;
            $score_cx["2.2"] += $score[155];
            $score[156] = ($answer_arr[156] == 1)?1:0;
            $score_cx["2.2"] += $score[156];
            $score[157] = getPickerScore($answer_arr[157],157);
            $score_cx["2.2"] += $score[157];
            $score[158] = getPickerScore($answer_arr[158],158);
            $score_cx["2.2"] += $score[158];
            $score[159] = getPickerScore($answer_arr[159],159);
            $score_cx["2.2"] += $score[159];
            $score[160] = getPickerScore($answer_arr[160],160);
            $score_cx["2.2"] += $score[160];
            $score[161] = getPickerScore($answer_arr[161],161);
            $score_cx["2.2"] += $score[161];
            $score[162] = ($answer_arr[162] == 1)?1:0;
            $score_cx["2.2"] += $score[162];
            $score[163] = ($answer_arr[163] == 1)?1:0;
            $score_cx["2.2"] += $score[163];
            $score[164] = getPickerScore($answer_arr[164],164);
            $score_cx["2.2"] += $score[164];
            if ($answer_arr[165] >= 2000) {
                $score[165] = 1;
            } else if ($answer_arr[165] < 2000 && $answer_arr[165] >= 1500) {
                $score[165] = 0.8;
            } else if ($answer_arr[165] < 1500 && $answer_arr[165] >= 1000) {
                $score[165] = 0.8;
            } else if ($answer_arr[165] < 1000 && $answer_arr[165] >= 500) {
                $score[165] = 0.7;
            } else if ($answer_arr[165] < 500 && $answer_arr[165] >= 100) {
                $score[165] = 0.5;
            } else if ($answer_arr[165] < 100 && $answer_arr[165] >= 1) {
                $score[165] = 0.2;
            } else if ($answer_arr[165] < 1) {
                $score[165] = 0;
            }
            $score_cx["2.2"] += $score[165];
            if ($answer_arr[166] >= 2000) {
                $score[166] = 1;
            } else if ($answer_arr[166] < 2000 && $answer_arr[166] >= 1500) {
                $score[166] = 0.8;
            } else if ($answer_arr[166] < 1500 && $answer_arr[166] >= 1000) {
                $score[166] = 0.7;
            } else if ($answer_arr[166] < 1000 && $answer_arr[166] >= 500) {
                $score[166] = 0.5;
            } else if ($answer_arr[166] < 500 && $answer_arr[166] >= 100) {
                $score[166] = 0.2;
            } else if ($answer_arr[166] < 100 && $answer_arr[166] > 0) {
                $score[166] = 0.1;
            } else if ($answer_arr[166] <= 0) {
                $score[166] = 0;
            }
            $score_cx["2.2"] += $score[166];
            $score[167] = getPickerScore($answer_arr[167],167);
            $score_cx["2.2"] += $score[167];
            $score[168] = getPickerScore($answer_arr[168],168);
            $score_cx["2.2"] += $score[168];
            $score_cx["2.2"] = $score_cx["2.2"]*0.5+$score["141_140_139"]*1.5;//2.2总分
            $score_cx_cj["2.2"] = ($score_cx["2.2"]/7)-1;//2.2差距
            array_push($info2,['2.2 知识产权能力及一级产出',getComparison($score_cx_cj['2.2']),round( $score_cx_cj['2.2']*100,1).'%',getComparisonIos('2.2',$score_cx_cj['2.2']),'ISO56002/7.8   ISO56005/4.1']);
            //2.3知识产权架构与活动
            $score_cx["2.3"] = 0;
            $score[97] = getPickerScore($answer_arr[97],97);
            $score_cx["2.3"] += $score[97];
            $score_cx["2.3"] += $score[142];
            $score_cx["2.3"] += $score[143];
            $score_cx["2.3"] += $score[144];
            $score_cx["2.3"] += $score[146];
            $score[147] = getPickerScore($answer_arr[147],147);
            $score_cx["2.3"] += $score[147];
            $score[151] = getPickerScore($answer_arr[151],151);
            $score_cx["2.3"] += $score[151];
            $score_cx["2.3"] += $score[168];
            $score_cx["2.3"] = $score_cx["2.3"]*0.5;//2.3总分
            $score_cx_cj["2.3"] = ($score_cx["2.3"]/2.8)-1;//2.3差距
            array_push($info2,['2.3 知识产权架构与活动',getComparison($score_cx_cj['2.3']),round( $score_cx_cj['2.3']*100,1).'%',getComparisonIos('2.3',$score_cx_cj['2.3']),'ISO56002/7.8    ISO56005/4.3.2']);
            //2.4知识产权决策与职责
            $score_cx["2.4"] = 0;
            $score_cx["2.4"] += $score[97];
            $score[133] = getPickerScore($answer_arr[133],133);
            $score_cx["2.4"] += $score[133];
            $score[145] = ($answer_arr[145] == 1)?1:0;
            $score_cx["2.4"] += $score[145];
            $score_cx["2.4"] += $score[146];
            $score_cx["2.4"] += $score[152];
            $score_cx["2.4"] += $score[155];
            $score_cx["2.4"] = $score_cx["2.4"]*0.5;//2.4总分
            $score_cx_cj["2.4"] = ($score_cx["2.4"]/2.1)-1;//2.4差距
            array_push($info2,['2.4 知识产权决策与职责',getComparison($score_cx_cj['2.4']),round( $score_cx_cj['2.4']*100,1).'%',getComparisonIos('2.4',$score_cx_cj['2.4']),'ISO56002/7.8    ISO56005/5.1']);
            $result_data[2] = ['title' => '二、知识产权管理维度', 'info' => $info2];

            $info3 = [];//三 创新和知识产权战略、生态及考核KPI
            //3.1了解政策、产业趋势
            $score_cx["3.1"] = 0;
            $score[99] = getPickerScore($answer_arr[99],99);
            $score_cx["3.1"] += $score[99];
            $score[100] = getPickerScore($answer_arr[100],100);
            $score_cx["3.1"] += $score[100];
            $score_cx["3.1"] += $score[101];
            $score_cx["3.1"] += $score[102];
            $score[118] = ($answer_arr[118] == 1)?1:0;
            $score_cx["3.1"] += $score[118];
            $score[123] = getPickerScore($answer_arr[123],123);
            $score_cx["3.1"] += $score[123];
            $score_cx["3.1"] = $score_cx["3.1"]*0.5;//总分
            $score_cx_cj["3.1"] = ($score_cx["3.1"]/2.1)-1;//差距
            array_push($info3,['3.1 了解政策、产业趋势',getComparison($score_cx_cj['3.1']),round( $score_cx_cj['3.1']*100,1).'%',getComparisonIos('3.1',$score_cx_cj['3.1']),'ISO56002/4.1.2     ISO56005/4.1']);
            //3.2竞争者分析
            $score_cx["3.2"] = 0;
            $score_cx["3.2"] += $score[99];
            $score_cx["3.2"] += $score[100];
            $score_cx["3.2"] += $score[101];
            $score_cx["3.2"] += $score[102];
            $score_cx["3.2"] += $score[118];
            $score_cx["3.2"] += $score[123];
            $score_cx["3.2"] += $score[146];
            $score_cx["3.2"] = $score_cx["3.2"]*0.5;//总分
            $score_cx_cj["3.2"] = ($score_cx["3.2"]/2.45)-1;//差距
            array_push($info3,['3.2 知识产权决策与职责',getComparison($score_cx_cj['3.2']),round( $score_cx_cj['3.2']*100,1).'%',getComparisonIos('3.2',$score_cx_cj['3.2']),'ISO56002/6.1']);
            //3.3创新知识产权战略
            $score_cx["3.3"] = 0;
            $score_cx["3.3"] += $score[97];
            $score[104] = ($answer_arr[104] == 1)?1:0;
            $score_cx["3.3"] += $score[104];
            $score_cx["3.3"] += $score[146];
            $score_cx["3.3"] = $score_cx["3.3"]*1;//总分
            $score_cx_cj["3.3"] = ($score_cx["3.3"]/2.1)-1;//差距
            array_push($info3,['3.2 创新知识产权战略',getComparison($score_cx_cj['3.3']),round( $score_cx_cj['3.3']*100,1).'%',getComparisonIos('3.3',$score_cx_cj['3.3']),'ISO56002/7.8    ISO56005/5.2']);
            //3.4创新知识产权方针
            $score_cx["3.4"] = 0;
            $score_cx["3.4"] += $score[96];
            $score_cx["3.4"] += $score[104];
            $score_cx["3.4"] += $score[146];
            $score_cx["3.4"] = $score_cx["3.4"]*1;//总分
            $score_cx_cj["3.4"] = ($score_cx["3.4"]/2.1)-1;//差距
            array_push($info3,['3.4 创新知识产权方针',getComparison($score_cx_cj['3.4']),round( $score_cx_cj['3.4']*100,1).'%',getComparisonIos('3.4',$score_cx_cj['3.4']),'ISO56002/7.8  ISO56005/5.1']);
            //3.5行动及绩效考核KPI
            $score_cx["3.5"] = 0;
            $score[105] = ($answer_arr[105] == 1)?1:0;
            $score_cx["3.5"] += $score[105];
            $score[106] = getPickerScore($answer_arr[106],106);
            $score_cx["3.5"] += $score[106];
            $score_cx["3.5"] = $score_cx["3.5"]*1;//总分
            $score_cx_cj["3.5"] = ($score_cx["3.5"]/1.4)-1;//差距
            array_push($info3,['3.5 行动及绩效考核KPI',getComparison($score_cx_cj['3.5']),round( $score_cx_cj['3.5']*100,1).'%',getComparisonIos('3.5',$score_cx_cj['3.5']),'ISO56002/7.8  ISO56005/5.1']);
            //3.6创新外部资源配置
            $score_cx["3.6"] = 0;
            $score_cx["3.6"] += $score[102];
            $score[103] = getPickerScore($answer_arr[103],103);
            $score_cx["3.6"] += $score[103];
            $score_cx["3.6"] += $score[104];
            $score[107] = getPickerScore($answer_arr[107],107);
            $score_cx["3.6"] += $score[107];
            $score[108] = getPickerScore($answer_arr[108],108);
            $score_cx["3.6"] += $score[108];
            $score[110] = ($answer_arr[110] == 1)?1:0;
            $score_cx["3.6"] += $score[110];
            $score[111] = ($answer_arr[111] == 1)?1:0;
            $score_cx["3.6"] += $score[111];
            $score[113] = getPickerScore($answer_arr[113],113);
            $score_cx["3.6"] += $score[113];
            $score[114] = getPickerScore($answer_arr[114],114);
            $score_cx["3.6"] += $score[114];
            $score_cx["3.6"] = $score_cx["3.6"]*0.5;//总分
            $score_cx_cj["3.6"] = ($score_cx["3.6"]/3.15)-1;//差距
            array_push($info3,['3.6 创新外部资源配置',getComparison($score_cx_cj['3.6']),round( $score_cx_cj['3.6']*100,1).'%',getComparisonIos('3.6',$score_cx_cj['3.6']),'ISO56002/7.1、7.7']);
            $result_data[3] = ['title' => '三 创新和知识产权战略、生态及考核KPI', 'info' => $info3];

            $info4 = [];//四、创新流程和行动
            //4.1创新方案与计划
            $score_cx["4.1"] = 0;
            $score_cx["4.1"] += $score[102];
            $score_cx["4.1"] += $score[104];
            $score[116] = ($answer_arr[116] == 1)?1:0;
            $score_cx["4.1"] += $score[116];
            $score[117] = getPickerScore($answer_arr[117],117);
            $score_cx["4.1"] += $score[117];
            $score[134] = ($answer_arr[134] == 1)?1:0;
            $score_cx["4.1"] += $score[134];
            $score[135] = ($answer_arr[135] == 1)?1:0;
            $score_cx["4.1"] += $score[135];
            $score[136] = ($answer_arr[136] == 1)?1:0;
            $score_cx["4.1"] += $score[136];
            $score_cx["4.1"] = round($score_cx["4.1"]*0.286,2);//总分
            $score_cx_cj["4.1"] = ($score_cx["4.1"]/1.4)-1;//差距
            array_push($info4,['4.1 创新方案与计划',getComparison($score_cx_cj['4.1']),round( $score_cx_cj['4.1']*100,1).'%',getComparisonIos('4.1',$score_cx_cj['4.1']),'ISO56002/8.2']);
            //4.2识别研发课题流程
            $score_cx["4.2"] = 0;
            $score_cx["4.2"] += $score[96];
            $score_cx["4.2"] += $score[116];
            $score_cx["4.2"] += $score[117];
            $score_cx["4.2"] += $score[118];
            $score_cx["4.2"] += $score[123];//temp_score["3.1.6"]
            $score[149] = ($answer_arr[149] == 1)?1:0;
            $score_cx["4.2"] += $score[149];
            $score_cx["4.2"] = round($score_cx["4.2"]*0.333,2);//总分
            $score_cx_cj["4.2"] = ($score_cx["4.2"]/1.4)-1;//差距
            array_push($info4,['4.2 识别研发课题流程',getComparison($score_cx_cj['4.2']),round( $score_cx_cj['4.2']*100,1).'%',getComparisonIos('4.2',$score_cx_cj['4.2']),'ISO56002/8.3.2']);
            //4.3确定研发课题流程
            $score_cx["4.3"] = 0;
            $score_cx["4.3"] += $score[102];
            $score_cx["4.3"] += $score[103];//temp_score["3.6.2"]
            $score_cx["4.3"] += $score[116];
            $score_cx["4.3"] += $score[118];
            $score[119] = ($answer_arr[119] == 1)?1:0;
            $score_cx["4.3"] += $score[119];
            $score[120] = ($answer_arr[120] == 1)?1:0;
            $score_cx["4.3"] += $score[120];
            $score_cx["4.3"] += $score[136];
            $score_cx["4.3"] = round($score_cx["4.3"]*0.286,2);//总分
            $score_cx_cj["4.3"] = ($score_cx["4.3"]/1.4)-1;//差距
            array_push($info4,['4.3 确定研发课题流程',getComparison($score_cx_cj['4.3']),round( $score_cx_cj['4.3']*100,1).'%',getComparisonIos('4.3',$score_cx_cj['4.3']),'ISO56002/8.3.3']);
            //4.4创新发明和专利验证流程
            $score_cx["4.4"] = 0;
            $score[121] = getPickerScore($answer_arr[121],121);
            $score_cx["4.4"] += $score[121];
            $score[122] = ($answer_arr[122] == 1)?1:0;
            $score_cx["4.4"] += $score[122];
            $score[125] = getPickerScore($answer_arr[125],125);
            $score_cx["4.4"] += $score[125];
            $score_cx["4.4"] = round($score_cx["4.4"]*0.667,2);//总分
            $score_cx_cj["4.4"] = ($score_cx["4.4"]/1.4)-1;//差距
            array_push($info4,['4.4 确定研发课题流程',getComparison($score_cx_cj['4.4']),round( $score_cx_cj['4.4']*100,1).'%',getComparisonIos('4.4',$score_cx_cj['4.4']),'ISO56002/8.3.4']);
            //4.5创新结果实施方案设定过程
            $score_cx["4.5"] = 0;
            $score_cx["4.5"] += $score[121];
            $score_cx["4.5"] += $score[123];
            $score[126] = getPickerScore($answer_arr[126],126);
            $score_cx["4.5"] += $score[126];
            $score[127] = ($answer_arr[127] == 1)?1:0;
            $score_cx["4.5"] += $score[127];
            $score[128] = ($answer_arr[128] == 1)?1:0;
            $score_cx["4.5"] += $score[128];
            $score[129] = ($answer_arr[129] == 1)?1:0;
            $score_cx["4.5"] += $score[129];
            $score_cx["4.5"] = round($score_cx["4.5"]*0.333,2);//总分
            $score_cx_cj["4.5"] = ($score_cx["4.5"]/1.4)-1;//差距
            array_push($info4,['4.5 创新结果实施方案设定过程',getComparison($score_cx_cj['4.5']),round( $score_cx_cj['4.5']*100,1).'%',getComparisonIos('4.5',$score_cx_cj['4.5']),'ISO56002/8.3.5']);
            //4.6创新结果实施方案部署落实
            $score_cx["4.6"] = 0;
            $score[109] = getPickerScore($answer_arr[109],109);
            $score_cx["4.6"] += $score[109];
            $score_cx["4.6"] += $score[111];
            $score[124] = ($answer_arr[124] == 1)?1:0;
            $score_cx["4.6"] += $score[124];
            $score_cx["4.6"] += $score[126];
            $score_cx["4.6"] += $score[135];
            $score_cx["4.6"] = round($score_cx["4.6"]*0.4,2);//总分
            $score_cx_cj["4.6"] = ($score_cx["4.6"]/1.4)-1;//差距
            array_push($info4,['4.6 创新结果实施方案部署落实',getComparison($score_cx_cj['4.6']),round( $score_cx_cj['4.6']*100,1).'%',getComparisonIos('4.6',$score_cx_cj['4.6']),'ISO56002/8.3.6']);
            //4.7创新实施生态组合
            $score_cx["4.7"] = 0;
            $score_cx["4.7"] += $score[102];
            $score_cx["4.7"] += $score[110];
            $score_cx["4.7"] += $score[126];
            $score_cx["4.7"] += $score[152];
            $score_cx["4.7"] += $score[130];
            $score_cx["4.7"] += $score[131];
            $score_cx["4.7"] += $score[132];
            $score_cx["4.7"] += $score[136];
            $score_cx["4.7"] = round($score_cx["4.7"]*0.25,2);//总分
            $score_cx_cj["4.7"] = ($score_cx["4.7"]/1.4)-1;//差距
            array_push($info4,['4.7 创新结果实施方案部署落实',getComparison($score_cx_cj['4.7']),round( $score_cx_cj['4.7']*100,1).'%',getComparisonIos('4.7',$score_cx_cj['4.7']),'SO56002/6.4']);
            $result_data[4] = ['title' => '四 创新流程和行动', 'info' => $info4];

            $info5 = [];//五、创新支持维度
            //5.1创新内部和外部资源及工具
            $score_cx["5.1"] = 0;
            $score_cx["5.1"] += $score[101];
            $score_cx["5.1"] += $score[108];
            $score_cx["5.1"] += $score[110];
            $score_cx["5.1"] += $score[111];
            $score_cx["5.1"] += $score[113];
            $score_cx["5.1"] += $score[114];
            $score_cx["5.1"] += $score[124];
            $score_cx["5.1"] += $score[128];
            $score_cx["5.1"] = round($score_cx["5.1"]*0.5,2);//总分
            $score_cx_cj["5.1"] = ($score_cx["5.1"]/2.8)-1;//差距
            array_push($info5,['5.1 创新内部和外部资源及工具',getComparison($score_cx_cj['5.1']),round( $score_cx_cj['5.1']*100,1).'%',getComparisonIos('5.1',$score_cx_cj['5.1']),'ISO56002/7.1、7.6']);
            //5.2管理及持续创新能力
            $score_cx["5.2"] = 0;
            $score_cx["5.2"] += $score[92];
            $score_cx["5.2"] += $score[93];
            $score_cx["5.2"] += $score[94];
            $score_cx["5.2"] += $score[109];
            $score_cx["5.2"] += $score[128];
            $score_cx["5.2"] += $score[130];
            $score_cx["5.2"] = round($score_cx["5.2"]*0.5,2);//总分
            $score_cx_cj["5.2"] = ($score_cx["5.2"]/2.1)-1;//差距
            array_push($info5,['5.2 管理及持续创新能力',getComparison($score_cx_cj['5.2']),round( $score_cx_cj['5.2']*100,1).'%',getComparisonIos('5.2',$score_cx_cj['5.2']),'ISO56002/10.3']);
            //5.3文化意识
            $score_cx["5.3"] = 0;
            $score[112] = getPickerScore($answer_arr[112],112);
            $score_cx["5.3"] += $score[112];
            $score[115] = ($answer_arr[115] == 1)?1:0;
            $score_cx["5.3"] += $score[115];
            $score_cx["5.3"] += $score[147];
            $score[150] = getPickerScore($answer_arr[150],150);
            $score_cx["5.3"] += $score[150];
            $score_cx["5.3"] = round($score_cx["5.3"]*0.5,2);//总分
            $score_cx_cj["5.3"] = ($score_cx["5.3"]/1.4)-1;//差距
            array_push($info5,['5.3 文化意识',getComparison($score_cx_cj['5.3']),round( $score_cx_cj['5.3']*100,1).'%',getComparisonIos('5.3',$score_cx_cj['5.3']),'ISO56002/4.4.2、4.4.3']);
            //5.4创新沟通
            $score_cx["5.4"] = 0;
            $score_cx["5.4"] += $score[91];
            $score_cx["5.4"] += $score[98];
            $score_cx["5.4"] = round($score_cx["5.4"]*0.5,2);//总分
            $score_cx_cj["5.4"] = ($score_cx["5.4"]/0.7)-1;//差距
            array_push($info5,['5.4 创新沟通',getComparison($score_cx_cj['5.4']),round( $score_cx_cj['5.4']*100,1).'%',getComparisonIos('5.4',$score_cx_cj['5.4']),'ISO56002/5.2.2']);
            //5.5流程文档+成文信息
            $score_cx["5.5"] = 0;
            $score_cx["5.5"] += $score[135];
            $score_cx["5.5"] += $score[136];
            $score_cx["5.5"] += $score[137];
            $score_cx["5.5"] += $score[148];
            $score_cx["5.5"] += $score[151];
            $score_cx["5.5"] += $score[152];
            $score_cx["5.5"] += $score[156];
            $score_cx["5.5"] = round($score_cx["5.5"]*0.5,2);//总分
            $score_cx_cj["5.5"] = ($score_cx["5.5"]/2.45)-1;//差距
            array_push($info5,['5.5 流程文档+成文信息',getComparison($score_cx_cj['5.5']),round( $score_cx_cj['5.5']*100,1).'%',getComparisonIos('5.5',$score_cx_cj['5.5']),'ISO56002/7.5']);
            //5.6工具与方法
            $score_cx["5.6"] = 0;
            $score_cx["5.6"] += $score[102];
            $score_cx["5.6"] += $score[110];
            $score_cx["5.6"] += $score[117];
            $score_cx["5.6"] += $score[119];
            $score_cx["5.6"] += $score[120];
            $score_cx["5.6"] += $score[129];
            $score_cx["5.6"] += $score[149];
            $score_cx["5.6"] += $score[150];
            $score_cx["5.6"] = round($score_cx["5.6"]*0.5,2);//总分
            $score_cx_cj["5.6"] = ($score_cx["5.6"]/2.8)-1;//差距
            array_push($info5,['5.6 工具与方法',getComparison($score_cx_cj['5.6']),round( $score_cx_cj['5.6']*100,1).'%',getComparisonIos('5.6',$score_cx_cj['5.6']),'ISO56002/7.6']);
            $result_data[5] = ['title' => '五 创新支持维度', 'info' => $info5];

            $info6 = [];//六、创新绩效考核的设定、评定和提升
            //6.1创新绩效指标的设定
            $score_cx["6.1"] = 0;
            $score_cx["6.1"] += $score[105];
            $score_cx["6.1"] += $score[106];
            $score_cx["6.1"] += $score[130];
            $score_cx["6.1"] += $score[131];
            $score_cx["6.1"] += $score[133];
            $score_cx["6.1"] = round($score_cx["6.1"]*0.8,2);//总分
            $score_cx_cj["6.1"] = ($score_cx["6.1"]/2.8)-1;//差距
            array_push($info6,['6.1 创新绩效指标的设定',getComparison($score_cx_cj['6.1']),round( $score_cx_cj['6.1']*100,1).'%',getComparisonIos('6.1',$score_cx_cj['6.1']),'ISO56002/9.1']);
            //6.2绩效要求执行情况评判
            $score_cx["6.2"] = 0;
            $score_cx["6.2"] += $score[105];
            $score_cx["6.2"] += $score[130];
            $score_cx["6.2"] += $score[131];
            $score_cx["6.2"] += $score[134];
            $score_cx["6.2"] = round($score_cx["6.2"]*0.5,2);//总分
            $score_cx_cj["6.2"] = ($score_cx["6.2"]/1.4)-1;//差距
            array_push($info6,['6.2 绩效要求执行情况评判',getComparison($score_cx_cj['6.2']),round( $score_cx_cj['6.2']*100,1).'%',getComparisonIos('6.2',$score_cx_cj['6.2']),'ISO56002/9.2']);
            $result_data[6] = ['title' => '六 创新绩效考核的设定、评定和提升', 'info' => $info6];

            //---基础版---
            $info7 = [];//七、专利及知识产权维度
            $score_jc['1.1'] = getLevelScoreOne($answer_arr[28]+$answer_arr[29]+$answer_arr[30]+$answer_arr[31],$score2_arr[0],4);
            $score_word['1.1'] = getBaseComparison($answer_arr[28]+$answer_arr[29]+$answer_arr[30]+$answer_arr[31],$score2_arr[0],'1.1');
            array_push($info7,['7.1 授权专利、软著、商标、电路布图总数',$score_word['1.1']['one'],$score_word['1.1']['two'],$score_word['1.1']['three']]);

            // $score_jc['1.2'] = getLevelScoreOne($answer_arr[32],33,5);
            // $score_word['1.2'] = getBaseComparison($answer_arr[32],33,'1.2');
            $score_jc['1.2'] = getLevelScoreOne($answer_arr[32],$score2_arr[1],5);
            $score_word['1.2'] = getBaseComparison($answer_arr[32],$score2_arr[1],'1.2');
            array_push($info7,['7.2 已授权发明专利总数',$score_word['1.2']['one'],$score_word['1.2']['two'],$score_word['1.2']['three']]);

            // $score_jc['1.3'] = getLevelScoreOne($answer_arr[34],5,5);
            // $score_word['1.3'] = getBaseComparison($answer_arr[34],33,'1.3');
            $score_jc['1.3'] = getLevelScoreOne($answer_arr[34],$score2_arr[2],5);
            $score_word['1.3'] = getBaseComparison($answer_arr[34],$score2_arr[2],'1.3');
            array_push($info7,['7.3 已授权自主研发核心发明专利总数',$score_word['1.3']['one'],$score_word['1.3']['two'],$score_word['1.3']['three']]);

            $score_jc['1.4-7'] = 3.7;
            array_push($info7,['7.4 专利质量初审情况','有提升空间，争取达到打谁、防谁、和谁的专利质量六字方针','-70.0%','增量专利咨询, 提高营收与专利关联度']);
            array_push($info7,['7.5 专利布局初审情况','有待提高，争取达到保护自身技术，抵御外来诉讼风险的目标','-83.0%','增量专利咨询, 提高营收与专利关联度']);
            array_push($info7,['7.6 专利保护初审情况','有提升空间，在保证专利质量的前提下，要有布局和数量支撑','-53.0%','增量专利咨询, 提高营收与专利关联度']);
            array_push($info7,['7.7 专利侵权风险及规避初审情况','需重点关注，建议完善侵权预警分析，制定实施风险规避方案','-37.0%','二饼图方案及亮剑计划, 专利无效分析']);
            $result_data[7] = ['title'=>'七、专利及知识产权维度','info'=>$info7];

            $info8 = [];//八、研发维度
            // $score_jc['2.1'] = getLevelScoreOne($answer_arr[46],100,7);
            // $score_word['2.1'] = getBaseComparison($answer_arr[46],109,'2.1');
            $score_jc['2.1'] = getLevelScoreOne($answer_arr[46],$score2_arr[3],7);
            $score_word['2.1'] = getBaseComparison($answer_arr[46],$score2_arr[3],'2.1');
            array_push($info8,['8.1 研发人员总数',$score_word['2.1']['one'],$score_word['2.1']['two'],$score_word['2.1']['three']]);

            // $score_jc['2.2'] = getLevelScoreOne($answer_arr[78],2,4);
            // $score_word['2.2'] = getBaseComparison($answer_arr[78],2,'2.2');
            //坐标移动
            $academician_num = [0,1,2,3,4,5,6,7,8,9,10];
            $score_jc['2.2'] = getLevelScoreOne($academician_num[$answer_arr[78]-1],$score2_arr[4],4);
            $score_word['2.2'] = getBaseComparison($academician_num[$answer_arr[78]-1],$score2_arr[4],'2.2');
            array_push($info8,['8.2 顶级研发人员总数',$score_word['2.2']['one'],$score_word['2.2']['two'],$score_word['2.2']['three']]);

            if($answer_arr[24] > 0){
                $temp = $answer_arr[46]/$answer_arr[24];
            }else{
                $temp = 0;
            }
            //$temp_jisuanbishu = round($temp/0.22*8.4,2);
            $temp_jisuanbishu = round($temp/$score2_arr[5]*8.4,2);
            if($temp < 0.1){
                //$score_jc["2.3"] = getLevelScoreOne($temp,0.22,3);
                $score_jc["2.3"] = getLevelScoreOne($temp,$score2_arr[5],3);
            }else if($temp_jisuanbishu >= 8.4){
                $score_jc["2.3"] = 8.4;
            }else if($temp_jisuanbishu <= 8.4){
                $score_jc["2.3"] = $temp_jisuanbishu;
            }
            // $score_word['2.3'] = getBaseComparison($temp,0.22,'2.3');
            // $word_score_diffen32 = ($temp/0.22)-1;
            $score_word['2.3'] = getBaseComparison($temp,$score2_arr[5],'2.3');
            $word_score_diffen32 = ($temp/$score2_arr[5])-1;
            $word_score_diffen_text = "";
            if ($word_score_diffen32 > 0.01) {
                $word_score_diffen_text = '高于行业参考值';
            } else if ($word_score_diffen32 == 0.01) {
                $word_score_diffen_text = '相似于行业参考值';
            } else {
                if ($word_score_diffen32 == 0) {
                    $word_score_diffen_text = '与参考值差距较大，希望2年内达到21%的研发人员占比';
                } else {
                    $word_score_diffen_text = '低于行业参考值';
                }
            }
            array_push($info8,['8.3 研发人员占比',$word_score_diffen_text,$score_word['2.3']['two'],$score_word['2.3']['three']]);
            //2.4研发设施
            $word_2_4_diffen_text = $word_2_4_diffen_hundren=$word_2_4_diffen_text_one = "";
            if ($answer_arr[75] == 11 || $answer_arr[76] == "no") {//"11.都不是"
                $score_jc["2.4"] = 0;
                $word_2_4_diffen_text = "没有，与90%的同业申报企业情况相似";
                $word_2_4_diffen_hundren = "-10%";
                $word_2_4_diffen_text_one = "按“四个一流”研发体系要求补足短板";
            } else {
                $score_jc["2.4"] = 3.2;
                $word_2_4_diffen_text = "有，优于70%的同业申报企业";
                $word_2_4_diffen_hundren = "90%";
                $word_2_4_diffen_text_one = "已经满足目前要求";
            }
            array_push($info8,['8.4 是否拥有或掌握四个一流的研发体系',$word_2_4_diffen_text,$word_2_4_diffen_hundren,$word_2_4_diffen_text_one]);
            //2.5研发设施
            // $score_jc["2.5"] = getLevelScoreOne($answer_arr[47]+$answer_arr[48]+$answer_arr[49],10000,8.8);
            // $score_word['2.5'] = getBaseComparison($answer_arr[47]+$answer_arr[48]+$answer_arr[49],10000,'2.5');
            $score_jc["2.5"] = getLevelScoreOne($answer_arr[47]+$answer_arr[48]+$answer_arr[49],$score2_arr[6],8.8);
            $score_word['2.5'] = getBaseComparison($answer_arr[47]+$answer_arr[48]+$answer_arr[49],$score2_arr[6],'2.5');
            array_push($info8,['8.5 研发费用',$score_word['2.5']['one'],$score_word['2.5']['two'],$score_word['2.5']['three']]);
            //2.6研发费用占比
            // $temp = (($answer_arr[47]/$answer_arr[50]*0.5)+($answer_arr[48]/$answer_arr[51]*0.3)+($answer_arr[49]/$answer_arr[52]*0.2))/3;
            // $score_jc["2.6"] = getLevelScoreOne($temp,0.125,10);
            // $score_word['2.6'] = getBaseComparison($temp,0.125,'2.6');

            $temp1 = empty($answer_arr[50])?0:$answer_arr[47]/$answer_arr[50];
            $temp2 = empty($answer_arr[51])?0:$answer_arr[48]/$answer_arr[51];
            $temp3 = empty($answer_arr[52])?0:$answer_arr[49]/$answer_arr[52];
            $temp = ($temp1*0.5)+($temp2*0.3)+($temp3*0.2);
            // $score_jc["2.6"] = getLevelScoreOne($temp,$score2_arr[7],10);
            // $score_word['2.6'] = getBaseComparison($temp,$score2_arr[7],'2.6');
            $score_jc["2.6"] = getLevelScoreOne($temp,$score2_arr[7],10);
            $score_word['2.6'] = getBaseComparison($temp,$score2_arr[7],'2.6');

            array_push($info8,['8.6 研发费用占比',$score_word['2.6']['one'],$score_word['2.6']['two'],$score_word['2.6']['three']]);
            $result_data[8] = ['title'=>'八、研发维度','info'=>$info8];

            $info9 = [];//九、行政管理维度
            //3.1竞业限制和竞业禁止
            $word_3_1_diffen_text = $word_3_1_diffen_hundren = $word_3_1_diffen_text_one = '';
            if ($answer_arr[39] == 1) { //1:yes、2:no
                $score_jc["3.1"] = 2;
                $word_3_1_diffen_text = "有，但是要仔细审核相关文件，才可以得出结论";
                $word_3_1_diffen_hundren = "63%";
                $word_3_1_diffen_text_one = "已经满足目前要求";
            } else {
                $score_jc["3.1"] = 0;
                $word_3_1_diffen_text = "无，与37%的同业申报企业情况相似";
                $word_3_1_diffen_hundren = "-37%";
                $word_3_1_diffen_text_one = "现有资产保密流程, 补足竞业相关协议";
            }
            array_push($info9, ['9.1 竞业限制和竞业禁止', $word_3_1_diffen_text, $word_3_1_diffen_hundren, $word_3_1_diffen_text_one]);
            $result_data[9] = ['title' => '九、行政管理维度', 'info' => $info9];

            $info10 = [];//十、技术维度
            //4.1现有技术先进性复杂性
            $score_jc["4.1"] = 1;
            array_push($info10,['10.1 现有技术先进性和复杂性','缺乏先进性和复杂性，与83%的同业申报企业情况相似','-83%','以核心专利布局占比等维度, 分析说明']);
            //4.2现有技术国内红海或蓝海
            $word_4_2_diffen_text = $word_4_2_diffen_hundren = $word_4_2_diffen_text_one = "";
            if ($answer_arr[37] == 7) {//5个以上
                //红海
                $score_jc["4.2"] = 1;
                $word_4_2_diffen_text = "红海领域，与73%的同业申报企业情况相似";
                $word_4_2_diffen_hundren = "-27%";
                $word_4_2_diffen_text_one = "侵权预警和无效对方专利分析，及布局攻击型专利";
            } else {
                //蓝海
                $score_jc["4.2"] = 3;
                $word_4_2_diffen_text = "蓝海领域，与27%的同业申报企业情况相似";
                $word_4_2_diffen_hundren = "73%";
                $word_4_2_diffen_text_one = "已经满足目前要求";
            }
            array_push($info10, ['10.2 产业领域是否红海还是蓝海', $word_4_2_diffen_text, $word_4_2_diffen_hundren, $word_4_2_diffen_text_one]);
            $result_data[10] = ['title' => '十、技术维度', 'info' => $info10];

            $info11 = [];//十一、国内竞争维度
            //5.1是否获得国家重大立项
            $word_5_1_diffen_text = $word_5_1_diffen_hundren = $word_5_1_diffen_text_one = "";
            if ($answer_arr[66] == 8) {//以上都无
                $score_jc["5.1"] = 0;
                $word_5_1_diffen_text = "不是，与73%的同业申报企业情况相似";
                $word_5_1_diffen_hundren = "-73%";
                $word_5_1_diffen_text_one = "研发外协, 以前瞻专利布局做技术预测";
            } else {
                $score_jc["5.1"] = 5.1;
                $word_5_1_diffen_text = "是，优于65%的同业申报企业";
                $word_5_1_diffen_hundren = "27%";
                $word_5_1_diffen_text_one = "已经满足目前要求";
            }
            array_push($info11, ['11.1 是否获得国家重大立项', $word_5_1_diffen_text, $word_5_1_diffen_hundren, $word_5_1_diffen_text_one]);
            //5.2是否获得最高科技奖
            $word_5_2_diffen_text = $word_5_2_diffen_hundren = $word_5_2_diffen_text_one = "";
            if ($answer_arr[68] == 11) {//"无"
                $score_jc["5.2"] = 0;
                $word_5_2_diffen_text = "不是，与80%的同业申报企业情况相似";
                $word_5_2_diffen_hundren = "-80%";
                $word_5_2_diffen_text_one = "研发外协, 以前瞻专利布局做技术预测";
            } else {
                $score_jc["5.2"] = 2.3;
                $word_5_2_diffen_text = "是，优于80%的同业申报企业";
                $word_5_2_diffen_hundren = "20%";
                $word_5_2_diffen_text_one = "已经满足目前要求";
            }
            array_push($info11, ['11.2 是否获得最高科技奖', $word_5_2_diffen_text, $word_5_2_diffen_hundren, $word_5_2_diffen_text_one]);
            //5.3是否参与制定国家行业标准
            $word_5_3_diffen_text = $word_5_3_diffen_hundren = $word_5_3_diffen_text_one = "";
            if ($answer_arr[67] == 6) {//"没有参与过"
                $score_jc["5.3"] = 0;
                $word_5_3_diffen_text = "不是，与75%的同业申报企业情况相似";
                $word_5_3_diffen_hundren = "-75%";
                $word_5_3_diffen_text_one = "研发外协, 以前瞻专利布局做技术预测";
            } else {
                $score_jc["5.3"] = 3.1;
                $word_5_3_diffen_text = "是，优于75%的同业申报企业";
                $word_5_3_diffen_hundren = "25%";
                $word_5_3_diffen_text_one = "已经满足目前要求";
            }
            array_push($info11, ['11.3 是否参与制定国家行业标准', $word_5_3_diffen_text, $word_5_3_diffen_hundren, $word_5_3_diffen_text_one]);
            //5.4是否是国内行业的第一梯队
            $word_5_4_diffen_text = $word_5_4_diffen_hundren = $word_5_4_diffen_text_one = "";
            if ($answer_arr[70] == 1) { //1yes2no
                $score_jc["5.4"] = 4.2;
                $word_5_4_diffen_text = "是，优于70%的同业申报企业";
                $word_5_4_diffen_hundren = "30%";
                $word_5_4_diffen_text_one = "已经满足目前要求";
            } else {
                $score_jc["5.4"] = 0;
                $word_5_4_diffen_text = "不是，与70%的同业申报企业情况相似";
                $word_5_4_diffen_hundren = "-70%";
                $word_5_4_diffen_text_one = "研发外协, 以前瞻专利布局做技术预测";
            }
            array_push($info11, ['11.4 是否是国内行业的第一梯队', $word_5_4_diffen_text, $word_5_4_diffen_hundren, $word_5_4_diffen_text_one]);
            $result_data[11] = ['title' => '十一、国内竞争维度', 'info' => $info11];

            $info12 = [];//十二、国际竞争维度
            //6.1是否是国内行业的第一梯队
            $word_6_1_diffen_text = $word_6_1_diffen_hundren = $word_6_1_diffen_text_one = "";
            if ($answer_arr[71] == 1) {//1yes2no
                $score_jc["6.1"] = 5.7;
                $word_6_1_diffen_text = "是，优于60%的同业申报企业";
                $word_6_1_diffen_hundren = "40%";
                $word_6_1_diffen_text_one = "已经满足目前要求";
            } else {
                $score_jc["6.1"] = 0;
                $word_6_1_diffen_text = "不是，与60%的同业申报企业情况相似";
                $word_6_1_diffen_hundren = "-60%";
                $word_6_1_diffen_text_one = "研发外协, 以前瞻专利布局做技术预测";
            }
            array_push($info12, ['12.1 是否是行业全球龙头企业的供应商', $word_6_1_diffen_text, $word_6_1_diffen_hundren, $word_6_1_diffen_text_one]);
            //6.2是否是国内行业的第一梯队
            $word_6_2_diffen_text = $word_6_2_diffen_hundren = $word_6_2_diffen_text_one = "";
            if ($answer_arr[72] == 1) {//1yes2no
                $score_jc["6.2"] = 7.2;
                $word_6_2_diffen_text = "是，优于77%的同业申报企业";
                $word_6_2_diffen_hundren = "23%";
                $word_6_2_diffen_text_one = "已经满足目前要求";
            } else {
                $score_jc["6.2"] = 0;
                $word_6_2_diffen_text = "不是，与77%的同业申报企业情况相似";
                $word_6_2_diffen_hundren = "-77%";
                $word_6_2_diffen_text_one = "研发外协, 以前瞻专利布局做技术预测";
            }
            array_push($info12,['12.2 是否取代西方技术或产品', $word_6_2_diffen_text, $word_6_2_diffen_hundren, $word_6_2_diffen_text_one]);
            $result_data[12] = ['title' => '十二、国际竞争维度', 'info' => $info12];


            $souce_total_base = array_sum($score_jc); //基础版得分80.12
            $souce_total_cx = array_sum($score_cx); //创新管理得分72.34
            // dump($souce_total_base);
            // dump($souce_total_cx);

            //基础版计算分数
            $temp_score_onestart = 0;
            if ($souce_total_base >= 35 && $souce_total_base <= 45) {
                $temp_score_onestart = 10;
            }

            $temp_score_twoti = 0;
            if ($souce_total_base < 45) {
                if ($answer_arr[50] >= 8000) {
                    $temp_score_twoti = 15;
                } else if ($answer_arr[50] >= 6000) {
                    $temp_score_twoti = 10;
                } else if ($answer_arr[50] >= 4000) {
                    $temp_score_twoti = 7.5;
                } else if ($answer_arr[50] >= 2000) {
                    $temp_score_twoti = 5;
                }
            } else {
                if ($answer_arr[50] >= 20000) {
                    $temp_score_twoti = 15;
                } else if ($answer_arr[50] >= 10000) {
                    $temp_score_twoti = 11.25;
                } else if ($answer_arr[50] >= 5000) {
                    $temp_score_twoti = 7.5;
                } else if ($answer_arr[50] >= 2000) {
                    $temp_score_twoti = 3.75;
                }
            }
            $temp_score_threeti = 0;
            if ($souce_total_base < 45) {
                $profit = $answer_arr[60] + $answer_arr[59] + $answer_arr[58];
                if ($profit >= 2000) {
                    $temp_score_threeti = 15;
                } else if ($profit >= 1000) {
                    $temp_score_threeti = 10;
                } else if ($profit >= 500) {
                    $temp_score_threeti = 5;
                }
            }
            $temp_score_fourti = 0;
            if ($souce_total_base < 45) {
                $rd_cost = $answer_arr[49] + $answer_arr[48] + $answer_arr[47];
                if ($rd_cost >= 3000) {
                    $temp_score_fourti = 15;
                } else if ($rd_cost >= 2000) {
                    $temp_score_fourti = 10;
                } else if ($rd_cost > 1000) {
                    $temp_score_fourti = 5;
                }
            }
            $score_max_score = max([$temp_score_onestart,$temp_score_twoti, $temp_score_threeti, $temp_score_fourti]);
            $score_sum_base_one = 0;
            if ($answer_arr[49] + $answer_arr[48] + $answer_arr[47] < 2000) {
                $score_sum_base_one = $score_max_score * 0.8 + $souce_total_base;
            }else{
                $score_sum_base_one = $souce_total_base + $score_max_score;
            }
            $temp_score_oneti = getScoreExd($answer_arr[17],17);

            //行业加分值
            $score_sum_base_addfive = 5;
            //第二次计算基础版得分计算
            $score_sum_base_onescore = $score_sum_base_one + $temp_score_oneti + $score_sum_base_addfive;

            //上市未上市
            $is_list_score_addsub = 0;
            if ($score_sum_base_onescore <= 80 && $score_sum_base_onescore > 75 && $answer_arr[26] == 2) {
                $is_list_score_addsub = -3;
            } else if ($score_sum_base_onescore <= 90 && $score_sum_base_onescore > 85 && $answer_arr[26] == 1) {
                $is_list_score_addsub = -3;
            } else if ($score_sum_base_onescore <= 85 && $score_sum_base_onescore > 80 && $answer_arr[26] == 2) {
                $is_list_score_addsub = -5;
            } else if ($score_sum_base_onescore <= 95 && $score_sum_base_onescore > 90 && $answer_arr[26] == 1) {
                $is_list_score_addsub = -5;
            } else if ($score_sum_base_onescore <= 90 && $score_sum_base_onescore > 85 && $answer_arr[26] == 2) {
                $is_list_score_addsub = -10;
            }else if ($score_sum_base_onescore <= 100 && $score_sum_base_onescore > 95 && $answer_arr[26] == 1) {
                $is_list_score_addsub = -10;
            }else if ($score_sum_base_onescore <= 95 && $score_sum_base_onescore > 90 && $answer_arr[26] == 2) {
                $is_list_score_addsub = -15;
            }else if ($score_sum_base_onescore <= 105 && $score_sum_base_onescore > 100 && $answer_arr[26] == 1) {
                $is_list_score_addsub = -15;
            }else if ($score_sum_base_onescore <= 100 && $score_sum_base_onescore > 95 && $answer_arr[26] == 2) {
                $is_list_score_addsub = -20;
            }else if ($score_sum_base_onescore > 105 && $answer_arr[26] == 1) {
                $is_list_score_addsub = -20;
            }else if ($score_sum_base_onescore <= 105 && $score_sum_base_onescore > 100 && $answer_arr[26] == 2) {
                $is_list_score_addsub = -25;
            }else if ($score_sum_base_onescore > 105 && $answer_arr[26] == 2) {
                $is_list_score_addsub = -30;
            }
            $score_sum_base_onescore = $score_sum_base_onescore + $is_list_score_addsub;

            //首次算出得分
            $base_one_get_score = 0;
            if($score_sum_base_onescore > 80 && $answer_arr[26] == 2){
                $base_one_get_score = 80;
            }else if ($score_sum_base_onescore > 90 &&  $answer_arr[26] == 1){
                $base_one_get_score = 90;
            }else{
                $base_one_get_score = $score_sum_base_onescore;
            }
            //二次扣分项，再次对总数进行扣减
            $base_again_score_addsub = 0;
            if ($base_one_get_score <= 60) {
                $base_again_score_addsub = 0;
            } else if ($base_one_get_score > 60 && $answer_arr[58] < -2000 && $answer_arr[58] > -5000) {
                $base_again_score_addsub = -5;
            } else if ($base_one_get_score > 60 && $answer_arr[58] <= -5000 && $answer_arr[58] > -10000) {
                $base_again_score_addsub = -10;
            } else if ($base_one_get_score > 60 && $answer_arr[58] <= -10000) {
                $base_again_score_addsub = -10;
            } else if ($base_one_get_score > 60 && $answer_arr[28] < 5) {
                $base_again_score_addsub = -15;
            } else if ($base_one_get_score > 60 && $answer_arr[28] < 10 && $answer_arr[28] >= 5) {
                $base_again_score_addsub = -10;
            } else if ($base_one_get_score > 60 && $answer_arr[28] < 20 && $answer_arr[28] >= 10) {
                $base_again_score_addsub = -5;
            }
            //创造性属性计算
            //每年研发费用占比计算
            $yanfa_prece_one = 0;
            $yanfa_prece_teo = 0;
            $yanfa_prece_three = 0;
            $yanfa_prece_status = 0;
            $profit_prece_status = 0;
            $people_prece_status = 0;
            if ($answer_arr[50] > 0) {
                $yanfa_prece_one = $answer_arr[47] / $answer_arr[50];
            }
            if ($answer_arr[51] > 0) {
                $yanfa_prece_teo = $answer_arr[48] / $answer_arr[51];
            }
            if ($answer_arr[52] > 0) {
                $yanfa_prece_three = $answer_arr[49] / $answer_arr[52];
            }
            if ($yanfa_prece_one > 0.05 || $yanfa_prece_teo > 0.05 || $yanfa_prece_three > 0.05 || ($answer_arr[47] + $answer_arr[48] + $answer_arr[49]) > 6000) {
                $yanfa_prece_status = 1;
            }
            //营收额标准评判
            if ($answer_arr[52] > 0) {
                if ($answer_arr[50] > 30000 || (pow($answer_arr[50] / $answer_arr[52], 3) - 1) > 0.2) {
                    $profit_prece_status = 1;
                }
            }
            //研发角度分析
            if ($answer_arr[46] / $answer_arr[24] > 0.1) {
                $people_prece_status = 1;
            }
            //计算创造性指标1
            $create_index_one = 0;
            $create_index_two = 0;
            if ($answer_arr[34] > 5 && $yanfa_prece_status == 1 && $profit_prece_status == 1 && $people_prece_status == 1) {
                $create_index_one = 1;
            }
            //计算创造性指标2 && ()
            $temp_guojilignxian = 0;
            if ($answer_arr[77] == 2 || $answer_arr[77] == 3) {
                $temp_guojilignxian = 1;
            }
            if ($answer_arr[34] > 50 || $answer_arr[72] == 1 || $answer_arr[66] != 8 || $answer_arr[68] != 11 || $temp_guojilignxian == 1) {
                $create_index_two = 1;
            }
            //判断是否有创造性
            $is_create_index = 0;
            if ($create_index_one == 1 || $create_index_two == 1) {
                $is_create_index = 1;
            }
            $base_again_score_addsub_two = 0;
            if ($is_create_index == 0 && $base_one_get_score > 60 && $base_one_get_score < 80) {
                $base_again_score_addsub_two = -10;
            } else if ($is_create_index == 0 && $base_one_get_score > 80) {
                $base_again_score_addsub_two = -20;
            }
            //基础版最终得分
            $base_score_count_one = $base_one_get_score + $base_again_score_addsub + $base_again_score_addsub_two;

            //三种计算方式
            $calculate_one_score = ($base_score_count_one * 0.7) + ($souce_total_cx * 0.3);
            $calculate_two_score = ($base_score_count_one * 0.5) + ($souce_total_cx * 0.5);
            $alculate_three_score = ($base_score_count_one * 0.3) + ($souce_total_cx * 0.7);

            $max_int_one = 0;
            if ($calculate_two_score < 70 && $answer_arr[55] == 4) {
                $max_int_one = 5;
            } else if ($calculate_two_score < 70 && $answer_arr[55] == 5) {
                $max_int_one = 10;
            } else if ($calculate_two_score < 70 && $answer_arr[55] == 6) {
                $max_int_one = 10;
            } else if ($calculate_two_score < 70 && $answer_arr[55] == 7) {
                $max_int_one = 15;
            } else if ($calculate_two_score >= 70 && $answer_arr[55] == 6) {
                $max_int_one = 5;
            } else if ($calculate_two_score >= 70 && $answer_arr[55] == 7) {
                $max_int_one = 10;
            }
            $max_int_two = 0;
            $base_five_score_count = $base_score_count_one * 0.5;
            if ($base_five_score_count < 70 && $answer_arr[54] == 8) {
                $max_int_two = 5;
            } else if ($base_five_score_count < 70 && $answer_arr[54] == 7) {
                $max_int_two = 4;
            } else if ($base_five_score_count < 70 && $answer_arr[54] == 6) {
                $max_int_two = 4;
            } else if ($base_five_score_count < 70 && $answer_arr[54] == 5) {
                $max_int_two = 4;
            } else if ($base_five_score_count < 70 && $answer_arr[54] == 4) {
                $max_int_two = 3;
            } else if ($base_five_score_count < 70 && $answer_arr[54] == 3) {
                $max_int_two = 3;
            } else if ($base_five_score_count < 70 && $answer_arr[54] == 2) {
                $max_int_two = 1;
            }
            $max_int_three = 0;
            if ($base_five_score_count <= 70 && $base_five_score_count > 60 && $answer_arr[26] == 1) {
                $max_int_three = 10;
            } else if ($base_five_score_count <= 60 && $answer_arr[26] == 1) {
                $max_int_three = 15;
            }
            $max_temp = max($max_int_one,$max_int_two,$max_int_three);

            $maxtwo_int_one = ($answer_arr[73] == "yes")?5:0;
            $maxtwo_int_two = 0;
            if ($answer_arr[74] == 3) {
                $maxtwo_int_two = 5;
            } else if ($answer_arr[74] == 2) {
                $maxtwo_int_two = 4;
            } else if ($answer_arr[74] == 1) {
                $maxtwo_int_two = 2;
            }
            $maxtwo_temp = max($maxtwo_int_one,$maxtwo_int_two);
            $score_sum = $calculate_two_score + $max_temp + $maxtwo_temp;

            //减分项目
            if($answer_arr[25] != 10){
                $score_sum = 0;//它有违法违规情况，归零
            }
            //对总数再次限制(2022年5月30日新增)
            $new_add_lase_score = 0;
            if ($score_sum_base_onescore <= 80 && $score_sum_base_onescore > 75 && $answer_arr[26] == 2) {
                $is_list_score_addsub = -3;
            } else if ($score_sum_base_onescore <= 90 && $score_sum_base_onescore > 85 && $answer_arr[26] == 1) {
                $is_list_score_addsub = -3;
            } else if ($score_sum_base_onescore <= 85 && $score_sum_base_onescore > 80 && $answer_arr[26] == 2) {
                $is_list_score_addsub = -5;
            } else if ($score_sum_base_onescore <= 95 && $score_sum_base_onescore > 90 && $answer_arr[26] == 1) {
                $is_list_score_addsub = -5;
            } else if ($score_sum_base_onescore <= 90 && $score_sum_base_onescore > 85 && $answer_arr[26] == 2) {
                $is_list_score_addsub = -10;
            }else if ($score_sum_base_onescore <= 100 && $score_sum_base_onescore > 95 && $answer_arr[26] == 1) {
                $is_list_score_addsub = -10;
            }else if ($score_sum_base_onescore <= 95 && $score_sum_base_onescore > 90 && $answer_arr[26] == 2) {
                $is_list_score_addsub = -15;
            }else if ($score_sum_base_onescore <= 105 && $score_sum_base_onescore > 100 && $answer_arr[26] == 1) {
                $is_list_score_addsub = -15;
            }else if ($score_sum_base_onescore <= 100 && $score_sum_base_onescore > 95 && $answer_arr[26] == 2) {
                $is_list_score_addsub = -20;
            }else if ($score_sum_base_onescore <= 110 && $score_sum_base_onescore > 105 && $answer_arr[26] == 1) {
                $is_list_score_addsub = -20;
            }else if ($score_sum_base_onescore <= 105 && $score_sum_base_onescore > 100 && $answer_arr[26] == 2) {
                $is_list_score_addsub = -25;
            }else if ($score_sum_base_onescore <= 115 && $score_sum_base_onescore > 110 && $answer_arr[26] == 1) {
                $is_list_score_addsub = -25;
            }else if ($score_sum_base_onescore <= 110 && $score_sum_base_onescore > 105 && $answer_arr[26] == 2) {
                $is_list_score_addsub = -30;
            }else if ($score_sum_base_onescore <= 120 && $score_sum_base_onescore > 115 && $answer_arr[26] == 1) {
                $is_list_score_addsub = -30;
            }else if ($score_sum_base_onescore <= 115 && $score_sum_base_onescore > 110 && $answer_arr[26] == 2) {
                $is_list_score_addsub = -35;
            }else if ($score_sum_base_onescore <= 125 && $score_sum_base_onescore > 120 && $answer_arr[26] == 1) {
                $is_list_score_addsub = -35;
            }else if ($score_sum_base_onescore <= 120 && $score_sum_base_onescore > 115 && $answer_arr[26] == 2) {
                $is_list_score_addsub = -40;
            }else if ($score_sum_base_onescore > 125 && $answer_arr[26] == 1) {
                $is_list_score_addsub = -40;
            }else if ($score_sum_base_onescore <= 125 && $score_sum_base_onescore > 120 && $answer_arr[26] == 2) {
                $is_list_score_addsub = -45;
            }else if ($score_sum_base_onescore > 125 && $answer_arr[26] == 2) {
                $is_list_score_addsub = -50;
            }
            $score_sum = $score_sum + $new_add_lase_score;

            //最终得分
            if($answer_arr[26] == 2 && $score_sum>80){
                $score_sum = 80;
            }else if($score_sum > 90 && $answer_arr[26] == 1){
                $score_sum = 90;
            }
            $score_sum = round($score_sum,2);

            //快速评语
            if ($score_sum < 20) {
                //S84
                $summary_preview = "20分以下-创新和综合实力还处于比较初级阶段，建议制定3-5年规划，需要通过3-5年准备，重点关注单项短板和量化差距，并通过与高端咨询机构的合作，按《调查表》单项列明的“高标准”补足短板，同时进入地方政府创新和上市梯队培育计划，为达到创新和知识产权管理体系初级版国际标准，或知识产权优势示范企业标准奠定基础。";
            } else if ($score_sum >= 20 && $score_sum < 40) {
                //S85
                $summary_preview = '有望达到知识产权优势企业标准，但是距离达标创新和知识产权管理体系初级版国际标准还有较长的时间。 建议同时启动国家知识产权优势和示范企业的申报工作，文字表述主营业务、技术研发和《调查表》列明的主要事项；重点关注单项短板和量化差距，并通过与高端咨询机构的合作，按《调查表》单项列明的“高标准”补足短板，同时进入地方政府创新和上市梯队培育计划，为获得更多的国家及创新和产业资质及完成上市奠定基础。';
            } else if ($score_sum >= 40 && $score_sum < 60) {
                //S86
                $summary_preview = '达到了知识产权优势企业标准，经过系列提升，有望在1-2年达到创新和知识产权管理体系初级版国际标准，或知识产权示范企业的标准。建议同时启动   国家知识产权优势和示范企业的申报工作，文字表述主营业务、技术研发和《调查表》列明的主要事项；重点关注单项短板和量化差距，并通过与高端咨询机构的合作，按《调查表》单项列明的“高标准”补足短板，同时进入地方政府创新和上市梯队培育计划，为获得更多的国家及创新和产业资质及完成上市奠定基础。';
            } else if ($score_sum >= 60 && $score_sum < 80) {
                //S87
                $summary_preview = '基本符合了创新和知识产权管理体系初级版国际标准，或知识产权示范企业的标准。建议立即启动国家知识产权示范企业的申报工作，文字表述主营业务、技术研发和《调查表》列明的主要事项；重点关注单项短板和量化差距，并通过与高端咨询机构的合作，按《调查表》单项列明的“高标准”补足短板，同时进入地方政府创新和上市梯队培育计划，为获得更多的国家及创新和产业资质及完成上市奠定基础。';
            } else if ($score_sum >= 80) {
                //S88
                $summary_preview = '已经符合或超过了创新和知识产权管理体系初级版国际标准，或知识产权示范企业的标准。建议立即启动国家知识产权示范企业的申报工作，文字表述主营业务、技术研发和《调查表》列明的主要事项；重点关注单项短板和量化差距，并通过与高端咨询机构的合作，按《调查表》单项列明的“高标准”补足短板，同时进入地方政府创新和上市梯队培育计划，为获得更多的国家及创新和产业资质及完成上市奠定基础。';
            }
            //$return_data = ['score'=>$score_sum,'summary_preview'=>$summary_preview,'content'=>$result_data];
            // dump($score_sum);die;
            //dump($result_data);die;
            //dump($return_data);die;
            $result_josn = json_encode($result_data,JSON_UNESCAPED_UNICODE);


            $company = $answer_arr[169];

            $company_guimo_arr = ['',"大型企业","中型企业","小型企业","微型企业"];
            $company_guimo = $company_guimo_arr[$answer_arr[18]];

            $company_isshangshi_arr = ['',"已上市","未上市"];
            $company_isshangshi= $company_isshangshi_arr[$answer_arr[26]];

            $company_code = $answer_arr[170];

            $company_lingyu = $cate['title'];

            //折线图
            $chart1 = $chart2 = [];
            foreach(array_values($score_jc) as $k=>$v){
                $chart1[$k]['label'] = $k+1;
                $chart1[$k]['y'] = $v;
            }
            $score_bz = [4,5,5,2,2,2,3,7,4,8.4,3.2,8.8,10,2,3,3,5.1,2.3,3.1,4.2,5.7,7.2];//标准分值
            foreach($score_bz as $k=>$v){
                $chart2[$k]['label'] = $k+1;
                $chart2[$k]['y'] = $v;
            }
            $chart1_json = json_encode($chart1,JSON_UNESCAPED_UNICODE);
            $chart2_json = json_encode($chart2,JSON_UNESCAPED_UNICODE);

            //科创属性
            $kechuang['title'] = '科创属性4+5 指引';
            $kechuang['info'] = [];
            $v1 = ($answer_arr[34]>5)?'是':'否';
            array_push($kechuang['info'],['k'=>'拥有5件或以上自主研发的与核心技术和产品相关的授权发明专利','v'=>$v1]);

            if(($temp1>0.05) || $temp2>0.05 || $temp3>0.05 || ($answer_arr[47]+$answer_arr[48]+$answer_arr[49])>6000){
                $v2 = '是';
            }else{
                $v2 = '否';
            }
            array_push($kechuang['info'],['k'=>'近三年研发投入占营业收入比例5%以上或近三年研发投入累计6000万以上','v'=>$v2]);


            $temp4 = empty($answer_arr[53])?0:$answer_arr[50]/$answer_arr[53];
            if($answer_arr[50]>30000 || pow($temp4,1/3)>0.2){
                $v3 = '是';
            }else{
                $v3 = '否';
            }
            array_push($kechuang['info'],['k'=>'最近一年营收总额达到3亿或三年复合增长率达到20％','v'=>$v3]);
            $v4 =($answer_arr[46]/$answer_arr[24] > 0.1)?'是':'否';
            array_push($kechuang['info'],['k'=>'研发人员占全员职工比例达到或超过10%','v'=>$v4]);
            $v5 = ($v1 == '是' && $v2 == '是' && $v3 == '是' && $v4 == '是')?'同时满足':'没有同时满足';
            array_unshift($kechuang['info'],['k'=>'第一套指引','v'=>$v5]);

            $v6 = ($answer_arr[34]>50)?'是':'否';
            $v7 = ($answer_arr[72] == 2 || $answer_arr[72] == '否')?'否':'是';
            $v8 = ($answer_arr[66] == 8 || $answer_arr[66] == '以上都无')?'否':'是';
            $v9 = ($answer_arr[77] == 2 || $answer_arr[77] == 3)?'是':'否';
            $v10 = ($answer_arr[68] == 11)?'否':'是';
            $v11 = ($v6 == '是' || $v7 == '是' || $v8 == '是' || $v9 == '是' || $v10 == '是')?'至少满足一项':'都不满足';
            $kechuang['info'][5] = ['k'=>'第二套指引','v'=>$v11];
            $kechuang['info'][6] = ['k'=>'拥有50件或以上自主研发的与核心技术和产品相关的授权发明专利','v'=>$v6];
            $kechuang['info'][7] = ['k'=>'是否有望替代西方技术产品','v'=>$v7];
            $kechuang['info'][8] = ['k'=>'是否承担国家重大科技专项','v'=>$v8];
            $kechuang['info'][9] = ['k'=>'是否拥有国家颁发的技术/产品国际领先或国家战略认证','v'=>$v9];
            $kechuang['info'][10] = ['k'=>'是否获得国家级别科技奖励','v'=>$v10];

            $kechuang['result'] = ($v5 == '同时满足' || $v11 == '至少满足一项')?'有科创属性':'没有科创属性';
            $kechuang = json_encode($kechuang,JSON_UNESCAPED_UNICODE);

            $dataR = ['score'=>$score_sum,'company'=>$company,'company_guimo'=>$company_guimo,'company_isshangshi'=>$company_isshangshi,'company_code'=>$company_code,'company_lingyu'=>$company_lingyu,'summary_preview'=>$summary_preview,'result_josn'=>$result_josn,'souce_total_base'=>$souce_total_base,'souce_total_cx'=>$souce_total_cx,'create_time'=>time(),'update_time'=>time(),'user_id'=>$user_id,'s_id'=>$s_id,'is_baogao'=>1];

            $flag = db::name('answer')->insertGetId($dataR);
            if($flag){
                unset($dataR['souce_total_base']);
                unset($dataR['souce_total_cx']);
                unset($dataR['update_time']);
                unset($dataR['user_id']);
                unset($dataR['s_id']);
                unset($dataR['is_baogao']);
                return  $dataR;
            }else{
                return return_json(2002,"访问出错！", '');
            }
        }catch(\Exception $e){
            //echo $e->getMessage(); // 返回自定义的异常信息
            //Log::error('失败原因:123'.$e->getMessage() );
            //var_dump(db::name('questions')->getLastSql());
            setLog('wenjuan',$e->getMessage());
            return return_json(2002,"访问出错！", '');
        }
    }



}